#!/usr/bin/env python3 
# -*- coding:utf-8 -*-

from bs4 import BeautifulSoup
from urllib.request import urlopen

bid_url = "https://www.mmtvip.com/front/invest/invest?bidId=364977"

bid_html = urlopen(bid_url).read().decode("utf-8")
# print(bid_html)

soup = BeautifulSoup(bid_html, features="lxml")
print(soup.title)

"""
如果网页中有过个同样的 tag, 比如链接 <a>, 我们可以使用 find_all() 来找到所有的选项
"""

all_href = soup.find_all('a')
# all_href = [l['href'] for l in all_href]
print('\n', all_href)

for l in all_href:
    print(l)

"""
解析 css : 按 Class 匹配
"""

# 解析
account = soup.findAll('a', {'class': 'zhanghu'})
for acc in account:
    # 打印出 tag 内的文字
    print(acc.get_text())
